<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAbilitiesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('abilities', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name', 128)->unique()->comment('权限点');
            $table->string('title', 128)->nullable()->comment('名称');
            $table->tinyInteger('type')->unsigned()->default(1)->comment('类型 1:菜单 2:接口');
            $table->tinyInteger('status')->unsigned()->default(1)->comment('1 启用; 0 禁用');
            $table->tinyInteger('menu')->unsigned()->default(1)->comment('1 作为菜单显示; 0 不显示');
            $table->string('condition', 200)->nullable();
            $table->integer('pid')->unsigned()->default(0)->comment('父级ID');
            $table->string('remark', 200)->nullable()->comment('备注');
            $table->string('icon', 200)->nullable()->comment('菜单图标');
            $table->integer('sort')->nullable()->default(0)->comment('菜单排序');
            $table->timestamps();
            $table->softDeletes();
        });

        \DB::statement("ALTER TABLE `abilities` comment '权限节点列表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('abilities');
    }
}
